Xbasic

BITMAP_TO_PNG Function

Syntax

PNG as B = BITMAP_TO_PNG(B bitmap_data [,C flags [,C backgroundcolor [,C text [,B alpha_bitmap_data ]]]])

Arguments

bitmap_dataBinary

The input BMP image.

flagsCharacter

Allowable values are:"G" = gray, "R" = RGB, "A" = RGB with Alpha mask, "I" = Interlaced.

backgroundcolorCharacter

The background color.

textCharacter

 

alpha_bitmap_dataBinary

The bitmap to use as an alpha (transparency) mask.

Returns

PNGBinary

Returns he new PNG image.

Description

The BITMAP_TO_PNG() function converts a Windows Bitmap (BMP) file to Portable Network Graphics (PNG) format . Flags include 'G'ray, 'R'gb, 'A'lpha-rgb 'I'nterlaced.

Example

dim ff as P
dim bb as B
dim cc as C
ff = file.open("C:\Documents\Xbasic Reference\Images\logo.bmp",FILE_RO_EXCLUSIVE)
bb = ff.readb(100000)
cc = bitmap_to_png(bb, "R")

See Also